﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendAnnounce2.aspx.cs" Inherits="ZX.WebApp.EditWidows.SysManager.SendAnnounce2"
    ValidateRequest="false" %>
    
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
    this.Label1.Text = Request.Form["content1"];
}

</script>

<!doctype html>

<html>
<head id="Head1" runat="server">
    <meta charset="utf-8" />
    <title>KindEditor ASP.NET</title>
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/datatable/assets/skins/sam/datatable.css" />
    <link href="../../Styles/base.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../../Scripts/CombinButton.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <link href="../../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/paginator/paginator-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/resize/resize-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/event-delegate/event-delegate-min.js"></script>
    <link href="../../Styles/extendTable.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/extend.validate.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <link href="../../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/ckeditor/ckeditor.js" type="text/javascript"></script>
    <script src="../../Scripts/Appjs/CheckModel.js" type="text/javascript"></script>
    <script src="../../Scripts/JavaScript/jquery.upload.js" type="text/javascript"></script>

    <link rel="stylesheet" href="../../Scripts/kindeditor-4.1.1/themes/default/default.css" />
	<link rel="stylesheet" href="../../Scripts/kindeditor-4.1.1/plugins/code/prettify.css" />
	<script charset="utf-8" src="../../Scripts/kindeditor-4.1.1/kindeditor.js"></script>
	<script charset="utf-8" src="../../Scripts/kindeditor-4.1.1/lang/zh_CN.js"></script>
	<script charset="utf-8" src="../../Scripts/kindeditor-4.1.1/plugins/code/prettify.js"></script>
	<script>
	    KindEditor.ready(function (K) {
	        var editor1 = K.create('#content1', {
	            cssPath: '../../Scripts/kindeditor-4.1.1/plugins/code/prettify.css',
	            uploadJson: '../../Scripts/kindeditor-4.1.1/asp.net/upload_json.ashx',
	            fileManagerJson: '../../Scripts/kindeditor-4.1.1/asp.net/file_manager_json.ashx',
	            allowFileManager: true,
	            afterCreate: function () {
	                var self = this;
	                K.ctrl(document, 13, function () {
	                    self.sync();
	                    K('form[name=form1]')[0].submit();
	                });
	                K.ctrl(self.edit.doc, 13, function () {
	                    self.sync();
	                    K('form[name=form1]')[0].submit();
	                });
	            }
	        });
	        prettyPrint();
	    });
	</script>
    <script type="text/javascript">

        $(document).ready(function () {
            $('#UpAccessoriesFileName').upload();
        });

        //设置链接样式
        var mouseobj;
        function SetLinkStyle(obj) {
            mouseobj = obj;
            obj.onmouseout = SetLinkMouseOutStyle;
            obj.style.cursor = "hand";
            obj.style.color = "#FE611B";
        }

        function SetLinkMouseOutStyle() {
            mouseobj.style.color = "#000000";
        }
        var ChangeDept = function () {
            //            var deptList = document.getElementById("SelectForDept");
            //             document.getElementById("txt_AreaHidden1").value=deptList.value;
        }


        //编码
        function Coding(str) {
            var re1 = /</g;
            var re2 = />/g;
            var re3 = /"/g;
            var re4 = /&/g;
            var re5 = /%/g;

            str = str.replace(re5, "%5");
            str = str.replace(re4, "%4");
            str = str.replace(re3, "%3");
            str = str.replace(re2, "%2");
            str = str.replace(re1, "%1");

            return str; //"
        }
        var handleSuccess1 = function (o) {
            RefreshData();
            window.parent.$("#tabs").tabs('close', '发布公告通知');


        }
        function RefreshData() {
            if (parent.NeedRefreshPage != null) {
                if (typeof (parent.NeedRefreshPage.LoadData) == "function") {
                    parent.NeedRefreshPage.RefreshData();
                }
            }
        }
        var handleFailure1 = function (o) {
            alert(o.responseText);
        }
        var callback1 =
        {

            success: handleSuccess1,
            failure: handleFailure1,
            argument: { foo: "foo", bar: "bar" }
        };

        var Save = function () {
            var Subject = document.getElementById("txtSubject").value;
            var Content = CKEDITOR.instances.tbContent.getData();
            $("#jsonDataContent").val(Coding(Content));

            var deptId = $("#DeptId").val()
            var formObject = document.getElementById('form1');
            YAHOO.util.Connect.setForm(formObject);
            var i = checkInputData();
            if (i == 1) {
                if (deptId == "") {
                    alert("发送范围不能为空");
                }
                else {
                    var url = "../../Extend/AjaxData/DataProcessin.aspx?entity=Announce&action=Save" + "&r=" + Math.random() + "&deptId=" + deptId + "";
                    var o = YAHOO.util.Connect.asyncRequest('Post', url, callback1);
                }
            }
        }


        var _fn, _id;
        function ShowDialog2(fn, id) {
            _fn = fn;
            _id = id;
            YAHOO.example.container.dialog1.show();
        }
        YAHOO.namespace("example.container");
        YAHOO.util.Event.onDOMReady(function () {
            var handleSubmit = function () {
                var editwindow = document.getElementById("EditUIWindow2");
                if (editwindow) {
                    editwindow.contentWindow.ChooseInfo();
                }
                YAHOO.example.container.dialog1.hide();
            };
            var handleCancel = function () {
                this.cancel();
            };
            var handleSuccess = function (o) {
                var response = o.responseText;
                response = response.split("<!")[0];
                document.getElementById("resp").innerHTML = response;
            };
            var handleFailure = function (o) {
                alert("Submission failed: " + o.status);
            };
            YAHOO.example.container.dialog1 = new YAHOO.widget.Dialog("dialog1",
					            { width: "620px",
					                height: "400px",
					                fixedcenter: true,
					                visible: false,
					                draggable: true,
					                close: true,
					                autofillheight: "body",
					                constraintoviewport: true,
					                buttons: [{ text: "确定", handler: handleSubmit, isDefault: true },
								            { text: "取消", handler: handleCancel}]
					            });
            YAHOO.example.container.dialog1.callback = { success: handleSuccess, failure: handleFailure };
            YAHOO.example.container.dialog1.render();
            //拖动大小dialog1
            var resize1 = new YAHOO.util.Resize("dialog1", {
                handles: ["br"],
                autoRatio: false,
                minWidth: 450,
                minHeight: 300,
                status: false
            });
            resize1.on("startResize", function (args) {
                if (this.cfg.getProperty("constraintoviewport")) {
                    var D = YAHOO.util.Dom;
                    var clientRegion = D.getClientRegion();
                    var elRegion = D.getRegion(this.element);
                    resize1.set("maxWidth", clientRegion.right - elRegion.left - YAHOO.widget.Overlay.VIEWPORT_OFFSET);
                    resize1.set("maxHeight", clientRegion.bottom - elRegion.top - YAHOO.widget.Overlay.VIEWPORT_OFFSET);
                } else {
                    resize1.set("maxWidth", null);
                    resize1.set("maxHeight", null);
                }

            }, YAHOO.example.container.dialog1, true);
            resize1.on("resize", function (args) {
                var panelHeight = args.height;
                this.cfg.setProperty("height", panelHeight + "px");
            }, YAHOO.example.container.dialog1, true);
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    <div>
        <div id="fieldForm">
            <table bordercolor="#e0ecf8" cellspacing="0" cellpadding="0" align="center" border="1"
                style="vertical-align: middle;" width="100%">
                <tr>
                    <td valign="middle" align="center" colspan="2">
                        <h3>
                            发布公告通知</h3>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label id="lblTitle" for="txtSubject">
                            标题:
                        </label>
                    </td>
                    <td>
                        <textarea style="display: none" id="jsonDataContent" rows="2" cols="2" name="jsonDataContent"></textarea>
                        <input id="txtSubject" style="width: 250px" runat="server" requiretype="1" onblur="checkRequireData($(this),'../../Images/icon/smallFail.gif');" />
                    </td>
                </tr>
                <tr>
                    <td style="20%">
                        <label id="lblDeptS">
                            发布范围:</label>
                    </td>
                    <td>
                        <input type="hidden" id="DeptId" name="DeptId" runat="server" />
                        <input id="txtDeptId" name="txtDeptId" runat="server" readonly="readonly" type="text"
                            style="width: 150px;" />
                        <button id="btnDeptId" name="G" type="button" class="btnCheck" style="width: 50px;">
                            选择</button>
                    </td>
                </tr>
                <tr>
                    <td style="width: 94px">
                        附件：
                    </td>
                    <td>
                        <span title="附件">
                            <asp:Label ID="lb_acc_list" runat="server"></asp:Label><input id="AccessoriesHidden"
                                type="hidden" runat="server">
                            <table id="AccessoriesTable" cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td colspan="2">
                                        <div>
                                            <input id="UpAccessoriesFileName" name="UpAccessoriesFileName" type="text" class="yui-upload"
                                                style="width: 160px" /></div>
                                    </td>
                                </tr>
                            </table>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td style="width: 94px" valign="top">
                        内容：
                    </td>
                    <td>
                        <textarea id="content1" cols="100" rows="8" style="width:700px;height:200px;visibility:hidden;" runat="server"></textarea>
                        <br />
                        <asp:Button ID="Button1" runat="server" Text="提交内容" /> (提交快捷键: Ctrl + Enter)
                    </td>
                </tr>
                <tr>
                    <td align="center" colspan="2">
                        <img src="../../Images/Peixun/save.bmp" title="保存" style="float: right
                                cursor: pointer" alt="保存" onclick="return Save();" style="cursor: pointer" />
                        <img src="../../Images/Peixun/cancel.bmp" title="重填" style="padding-left: 10px; cursor: pointer"
                            alt="重填" onclick="return ClearValue();" />
                    </td>
                </tr>
            </table>
        </div>
        <div id="dialog1" class="yui-pe-content">
            <div class="hd">
                客户选择</div>
            <div class="bd">
                <iframe id="EditUIWindow2" frameborder="0" src="" style="width: 100%; height: 100%;
                    margin: 0px; padding: 0px;"></iframe>
            </div>
        </div>
        <input type="hidden" id="ID" />
    </div>
    </form>
</body>
</html>
